package com.apr.configuration;

import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自定义MyBatis的配置规则；给容器中添加一个ConfigurationCustomizer；
 *
 * @author zlj
 */
@Configuration
public class MybatisConfig {

    @Bean
    public ConfigurationCustomizer configurationCustomizer() {
        return new ConfigurationCustomizer() {

            @Override
            public void customize(org.apache.ibatis.session.Configuration configuration) {
                /**
                 * 开启驼峰命名法
                 */
                configuration.setMapUnderscoreToCamelCase(true);
            }
        };
    }
}
